home *** CD-ROM | disk | FTP | other *** search
- import java.applet.AudioClip;
- import java.awt.Color;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Polygon;
- import java.awt.Rectangle;
- import java.io.DataInputStream;
- import java.io.IOException;
- import java.net.URL;
-
- final class ColSnd extends ColObj {
- private AudioClip m_colSnd;
- private ColGrph m_colGraphicObj;
- public Rectangle m_bounds;
- private byte playType = 1;
- private String thePath;
- private byte visable = 1;
- public boolean muted;
-
- public boolean EventProc(Event var1) {
- boolean var4 = false;
- if (var1 != null) {
- int var2 = (int)(((float)var1.x + this.m_colGraphicObj.m_xOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- int var3 = (int)(((float)var1.y + this.m_colGraphicObj.m_yOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- if (var1.key == 6969) {
- this.muted = true;
- var4 = true;
- }
-
- if (var1.key == 6970) {
- this.muted = false;
- var4 = true;
- }
-
- if (var1.key == 6971) {
- this.PlayClip();
- var4 = true;
- }
-
- if (var1.id == 502 && this.m_bounds.inside(var2, var3)) {
- if (this.playType == 2) {
- this.PlayClip();
- }
-
- var4 = true;
- }
- } else {
- this.PlayClip();
- var4 = true;
- }
-
- return var4;
- }
-
- public void draw(Graphics var1) {
- if (this.m_colSnd != null && this.visable == 1) {
- int var2 = (int)(((float)this.m_bounds.x - this.m_colGraphicObj.m_xOrg) * this.m_colGraphicObj.m_mag);
- int var3 = (int)(((float)this.m_bounds.y - this.m_colGraphicObj.m_yOrg) * this.m_colGraphicObj.m_mag);
- int var4 = (int)((float)this.m_bounds.width * this.m_colGraphicObj.m_mag);
- int var5 = (int)((float)this.m_bounds.height * this.m_colGraphicObj.m_mag);
- var1.setColor(Color.blue);
- var1.fillRect(var2, var3 + var5 / 2, var4 / 4, var5 / 2);
- var1.setColor(Color.red);
- Polygon var6 = new Polygon();
- var6.addPoint(var2, var3 + var5 / 2);
- var6.addPoint(var2 + var4 / 2, var3);
- var6.addPoint(var2 + var4 / 2, var3 + var5);
- var6.addPoint(var2, var3 + var5 / 2);
- var1.drawPolygon(var6);
- var1.fillPolygon(var6);
- var1.setColor(Color.yellow);
- var1.drawOval(var2 + var4 / 2, var3, var4 / 4, var5);
- var1.setColor(Color.yellow.darker());
- var1.fillOval(var2 + var4 / 2, var3, var4 / 4, var5);
- }
-
- }
-
- public ColSnd(DataInputStream var1, ColGrph var2, Graphics var3) throws IOException {
- this.m_colGraphicObj = var2;
- this.m_bounds = new Rectangle();
- this.m_bounds.y = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.x = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.height = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.width = (int)((float)var1.readInt() / 65536.0F);
- this.playType = var1.readByte();
- int var5 = var1.readInt();
- super.cvObjNum = (long)var1.readInt();
- this.visable = var1.readByte();
- this.thePath = new String();
-
- for(int var4 = 0; var4 < var5; ++var4) {
- String var10001 = this.thePath;
- this.thePath = var10001 + (char)var1.readByte();
- }
-
- var1.readByte();
- this.m_colSnd = this.m_colGraphicObj.m_appComp.getAudioClip(new URL(this.m_colGraphicObj.m_appComp.m_cvFilePath), this.thePath);
- this.m_colGraphicObj.m_appComp.showStatus("Reading sound object please wait...");
- if (this.m_colSnd != null) {
- if (this.playType == 1) {
- }
-
- if (this.playType == 3) {
- this.m_colSnd.play();
- }
- }
-
- }
-
- public void PlayClip() {
- if (this.m_colSnd != null && !this.muted) {
- this.m_colSnd.play();
- }
-
- }
-
- public int getType() {
- return 16;
- }
-
- public Rectangle getBounds() {
- return this.m_bounds;
- }
- }
-